/**
 * 
 */
package neptune.web.client.view.components.editor;

import neptune.web.client.model.topology.SerializableIPAddress;
import neptune.web.client.model.topology.SerializableNetworkInterface;

import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.TreeItem;

/**
 * @author Roberto Bifulco [RobertoBifulco.it] [info@robertoBifulco.it]
 * 
 */
public class IpAddressMenuBar extends MenuBar {

	private MenuItem rootItem;

	public IpAddressMenuBar(SerializableIPAddress ipAddr,
			SerializableNetworkInterface netIf, TreeItem item) {
		super(false);

		MenuItem props = new MenuItem("Properties", new IpAddrPropsCommand(
				ipAddr, item));
		MenuItem removeNode = new MenuItem("Remove", new RemoveIpAddrCommand(
				ipAddr, netIf, item));

		MenuBar options = new MenuBar(true);

		options.addItem(props);
		options.addItem(removeNode);

		rootItem = new MenuItem(ipAddr.getAddress(), options);
		addItem(rootItem);
		options.setStylePrimaryName("TopologyEditor-tree-NodeItem");
		this.setStylePrimaryName("TopologyEditor-tree-RootNodeItem");
	}

	/**
	 * @return the rootItem
	 */
	public MenuItem getRootItem() {
		return rootItem;
	}

}
